package com.hermit.system.controller;

import com.hermit.system.entity.BbsAdministratorEntity;
import com.hermit.system.service.LoginService;
import com.hermit.util.ReqResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 登录 控制层
 */
@RestController
@RequestMapping("api/system/login")
public class LoginController {
    private final Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private LoginService loginService;

    /**
     * 用户登录
     */
    @RequestMapping("/login")
    public ReqResult login(@RequestBody Map<String, Object> params) {
        logger.info("用户登录-控台");
        BbsAdministratorEntity res = loginService.login(params);
        return ReqResult.ok().put("res", res);
    }
}